<?php
    require_once('../includes/DbConnector.php');
    if(isset($_GET['action']) && !empty($_GET['action'])) {
        // INPUT DATA.
        $action = $_GET['action'];
        $connector  = new DbConnector();
        $sql = "select 
                b.name,
                b.postal_no,
                b.place,
                b.address,
                b.cover_charge,
                b.beer_price,
                b.description,
                b.age_limit,
                b.user_id,
                bs.name status_name
                from bar b, bar_status bs
                where b.status_id = bs.status_id
                and b.status_id = 4";
        $result = $connector->query($sql);
        
        $a=array();
        while($row = mysql_fetch_array($result)){
            array_push($a,$row);
        }
        echo json_encode($a);
    }
?>